package pattern23;

import java.util.ArrayList;
import java.util.List;

/**
 * p279
 * 解释器模式
 * @author wdl
 */
public class InterpreterPattern {
    public static void main(String[] args) {
        Context context=new Context();

        List<BaseExpression> expressionList=new ArrayList<>();
        expressionList.add(new TerminalExpression());
        expressionList.add(new NonTerminalExpression());
        expressionList.add(new TerminalExpression());
        expressionList.add(new TerminalExpression());

        for (BaseExpression expression:
             expressionList) {
            expression.interpret(context);
        }
    }
}
